package com.test.controller;

import com.test.service.UserService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


/**
 * Created by lms on 2017/10/25.
 */
@Controller
public class UserController {

    Logger logger = Logger.getLogger(UserController.class);
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/user/{userName}/{mobile}", method = RequestMethod.POST)
    @ResponseBody
    public boolean user(@PathVariable String userName, @PathVariable String mobile) {
        logger.info("controller 查询用户信息 ------------>userName:"+userName + "mobile:" + mobile);

        int insert = userService.addUser(userName, mobile);

        return insert > 0;
    }

//    @RequestMapping(value = "/getUser", method = RequestMethod.POST)
//    public String getUser(HttpServletRequest request) {
//
//        List<User> user = userService.getUser();
//        request.setAttribute("data", user);
//        return "user";
//    }
}
